﻿/**********************************************************************
 * @file   FEPointJunctionDialog.h
 * @brief  FE点连接对话框
 * @author liuzhonghua (liuzhonghuaszch@163.com)
 * @date   2025-01-23
 *********************************************************************/
#ifndef _FEPointJunctionDialog_H
#define _FEPointJunctionDialog_H

#include "GUIJunctionDialogAPI.h"
#include "GUIJunctionDialogBase.h"
#include "FITK_Component/FITKAcousticsModel/FITKAbstractJunction.h"

namespace Ui {
    class FEPointJunctionDialog;
}

namespace EventOper {
    class ParaWidgetInterfaceOperator;
}

namespace Acoustics {
    class FITKFEJunctionPoint;
}

namespace GUI
{
    /**
     * @brief  点连接对话框
     * @author liuzhonghua (liuzhonghuaszch@163.com)
     * @date   2024-11-12
     */
    class GUIJunctionDialogAPI FEPointJunctionDialog :public GUIJunctionDialogBase
    {
        Q_OBJECT;
    public:
        /**
         * @brief    构造函数
         * @param[i] dataID        数据id
         * @param[i] oper          操作器
         * @param[i] isCreate      是否创建
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2024-11-12
         */
        FEPointJunctionDialog(int dataID, EventOper::ParaWidgetInterfaceOperator* oper, bool isCreate);
        /**
         * @brief    析构函数
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2024-11-12
         */
        ~FEPointJunctionDialog();
        /**
         * @brief    初始化
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2024-11-12
         */
        void init();
        /**
         * @brief    设置关联的子系统
         * @param[i] subsys  有效连接点关联的子系统与连接点的ID
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2024-11-12
         */
        void setSubsysIDs(QList<QPair<int, int>> subsys);
        /**
         * @brief    设置节点（连接后创建的点）
         * @param[i] nodeID    节点id
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2024-11-12
         */
        void setNode(int nodeID);

    private slots:
        /**
         * @brief    OK按钮点击事件
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2024-11-13
         */
        void on_pushButton_Ok_clicked();
        /**
         * @brief    取消按钮点击事件
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2024-11-13
         */
        void on_pushButton_Cancel_clicked();

    private:
        /**
         * @brief    创建初始化
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2024-11-12
         */
        void InitCreate();
        /**
         * @brief    编辑初始化
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2024-11-12
         */
        void InitEdit();
        /**
         * @brief    初始化表格
         * @param[i] subSysIds
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-02-07
         */
        void initTable(QList<Acoustics::FITKFEJunPointConStr> connection);
        /**
         * @brief    更新点表格
         * @param[i] pointID            点id
         * @author   BaGuijun (baguijun@163.com)
         * @date     2024-11-12
         */
        void initWidgetNodeData(int pointID);
        /**
         * @brief    创建确定
         * @return   bool         是否成功
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2024-11-12
         */
        bool OKCreate();
        /**
         * @brief    编辑确定
         * @return   bool         是否成功
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2024-11-12
         */
        bool OKEdit();
        /**
         * @brief    将界面数据填充至数据对象中
         * @param[i] data     数据对象
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2024-11-12
         */
        void getDataFromWidget(Acoustics::FITKFEJunctionPoint* data);
        /**
         * @brief    将数据对象中的数据填充至界面
         * @param[i] data     数据对象
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2024-11-12
         */
        void setDataToWidget(Acoustics::FITKFEJunctionPoint* data);

    private:
        /**
         * @brief  ui对象
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2024-11-12
         */
        Ui::FEPointJunctionDialog* _ui = nullptr;
    };
}
#endif
